<include file="public:header" />
<div class="subnav">
<h1 class="title_2 line_x">本接口用于高效转淘客链接,申请前请先登陆淘宝账号,然后获取session，通常情况下session可保存一个月左右！ </a></h1>
</div>
<div class="pad_lr_10">
    <form id="J_info_form" action="{:U('Privilege/setting')}" method="post">
    <table width="100%" cellspacing="0" class="table_form">
	     <tr>
            <th width="150">账号登陆sessionKey :</th>
            <td><textarea rows="10" cols="100" name="session" readonly>{:C('itk_user_session')}</textarea></td>
        </tr>	
	     <tr>
            <th width="150">账号登陆时间 :</th>
            <td><input type="text" size="20" class="input-text" name="sessionTime" value="{$itk_session_time}" readonly></input>
            <span class="red"> 预计 {$itk_session_etime}  后失效</span>
            </td>
            
        </tr>        	
        <tr>
            <th width="150">选择商品分类 :</th>
            <td>
			<select class="J_cate_select mr10" data-pid="0" data-uri="{:U('items_cate/ajax_getchilds', array('type'=>0))}"></select>
			 <input type="hidden" name="cate_id" id="J_cate_id" />
			 <span class="gray ml10">可以不选</span>
			</td>
        </tr>	
        <tr>
            <th width="100">转换已有高效链接的商品 :</th>
            <td>
                <label class="mr10"><input name="privilege_type" type="radio" class="J_change_status"  value="1" > 开启</label>
                <label><input name="privilege_type" type="radio" class="J_change_status" checked="checked" value="0" > 关闭</label>
                <span class="gray ml10">接口有两个,分别是本地与云库,云库限制比较大,建议选择本地接口</span>
            </td>
        </tr>	
		
		<tr>
          <th>商品ID起始范围 :</th>
          <td>
		  <input type="text" name="fid" size="10" class="input-text" value="0"/> - 
          <input type="text" name="eid" size="10" class="input-text" value="0"/>
		  <span class="red">商品站内ID，即商品管理列表中商品图片前面的数字ID，如需全部申请请输入0,已申请过的不会重复申请</span>
		  </td>
          </tr>
        <tr>    
		<tr>
          <th></th>
          <td>
		  <span class="red">申请前请先点击登陆淘宝账户,sessionKey通常可保持一个月，如果返回sessionKey失效，则请重新登陆</span>
		  </td>
        </tr>
        <tr>         
            <td><a href="{:U('Login/itaoke',array('mod'=>'taobao'))}" ><input value="登陆淘宝账户" name="dosubmit" id="login" class="smt mr10"></a></td>
            <td><input type="submit" value="开始申请" name="dosubmit" class="smt mr10"></td>
        </tr>
    </table>
   
    </form>	
</div>
<include file="public:footer" />
<script>
$('.J_cate_select').cate_select('请选择');
$(function(){
    var collect_url = "{:U('Privilege/collect')}";
    $('#J_info_form').ajaxForm({success:complete, dataType:'json'});
    var p = 2;
    function complete(result){
        if(result.status == 1){
            $.dialog({id:'direct', title:result.msg, content:result.data, padding:'', lock:true});
            p = 2;
            collect_page();
        } else {
            $.itaoke.tip({content:result.msg, icon:'alert'});
        }
    }
    function collect_page(){
        $.getJSON(collect_url, {p:p}, function(result){
            if(result.status == 1){
                $.dialog.get('direct').content(result.data);
                p++;
                collect_page(p);
            }else{
                $.dialog.get('direct').close();
                $.itaoke.tip({content:result.msg});
            }
        });
    }
   
});
   
</script>
</body>
</html>